<!---builds a directory tree with cftree...this creates the cftree items based on folders the user has access to--->
<cfparam name="attributes.parent" type="string" default="">
<cfparam name="attributes.parentname" type="string" default="">
<cfparam name="attributes.taginit" type="boolean" default="No">
<cfparam name="attributes.mode" type="string" default="copy">
<cfparam name="attributes.basepath" type="string" default="#request.basepath#">


<cfif attributes.taginit IS 'No'>
    <cfloop list="#request.folder_accesslist#" delimiters="," index="dir">
        <cfif directoryexists('#attributes.basepath##dir#')>
            <cftreeitem value="#dir#" parent="dirtree" expand="no" href="javascript: $(this).dialog('close'); fmdo#attributes.mode#('#dir#/');">
            
            <cfset nextparent = "#dir#/">
            <cfmodule Template="directorytree.cfm"
                    parent="#nextparent#"
                    parentname="#dir#"
                    taginit="Yes"
                    mode="#attributes.mode#"
                    basepath="#attributes.basepath#">			
        
        </cfif>
    </cfloop>
<cfelse>	 
	<cfdirectory name="dir" directory="#attributes.basepath##attributes.parent#" type="dir" sort="name">
	<cfloop query="dir">		
		<cfif directoryexists('#attributes.basepath##attributes.parent#')>
			<cftreeitem value="#name#" parent="#attributes.parentname#" expand="no" href="javascript: $(this).dialog('close'); fmdo#attributes.mode#('#attributes.parent##name#/');">
            <cfset nextparent = '#attributes.parent##name#/'>
	        <cfmodule Template="directorytree.cfm"
                parent="#nextparent#"
                parentname="#name#"
                taginit="Yes"
                mode="#attributes.mode#"
				basepath="#attributes.basepath#">        
        </cfif>						
	</cfloop>
</cfif>